package test.aop.jdk;

import java.lang.reflect.Proxy;

/**
 * Jdk版的动态代理必须借助接口, 甚至抽象类都不行
 */
public class Main {

    public static void main(String[] args) {
        Student stu = new Student();
        ProxyCheckWork decoration = new ProxyCheckWork(stu);
        DoHomeWork newStu = (DoHomeWork) Proxy.newProxyInstance(stu.getClass().getClassLoader(),
                stu.getClass().getInterfaces(), decoration);
        newStu.login();
        newStu.submit();
    }
}
